package IO.io_5_9;

import java.io.*;

/**
 * @author bruin_du
 * @description 文件输出
 * @date 2022/5/12 15:18
 **/
public class WriteTest {
    public static void main(String[] args) throws IOException {
        try(OutputStream os = new FileOutputStream("world2.txt")){
            try(Writer writer = new OutputStreamWriter(os,"UTF-8")){
                try(PrintWriter printWriter = new PrintWriter(writer)){
                    printWriter.println("你好世界");
                    printWriter.print("中国");
                    printWriter.printf("%s %d\r\n","好起来",321);

                    printWriter.flush();
                }
            }
        }
    }
}
